﻿using RabbitMQSample.WebApi.RabbitMQLibs;

namespace RabbitMQSample.WebApi.Samples
{
    public class RabbitMQShareProducerSingletonSample : RabbitMQShareProducerBase, IDisposable
    {
        private const string RoutingKey = "demo_routing_key";
        private const string ExchangeName = "demo_exchange";

        public RabbitMQShareProducerSingletonSample(IRabbitMQConnectionFactory rabbitMQConnectionFactory, ILogger<RabbitMQShareProducerSingletonSample> logger) : base(rabbitMQConnectionFactory, logger)
        {
        }

        public async Task<bool> ProduceWithConfirmAsync(string msg, CancellationToken stoppingToken = default)
        {
            return await base.ProduceWithConfirmAsync(RoutingKey, msg, ExchangeName, stoppingToken);
        }

        public virtual async Task<bool> ProduceAsync(string msg, CancellationToken stoppingToken = default)
        {
            return await base.ProduceAsync(RoutingKey, msg, ExchangeName, stoppingToken);
        }
    }
}
